package com.beep.erp.model.stockIn.stockindetail;

import com.beep.erp.common.base.BaseBean;
import com.beep.erp.common.bean.StockInDetailBean;
import com.beep.erp.common.bean.StockListBean;
import com.beep.erp.http.HttpExceptionHandle;
import com.beep.erp.http.HttpResultSubscriber;
import com.beep.erp.model.addinstock.SaveStockBody;
import com.beep.erp.model.stockdetail.StockDetailContract;

import rx.schedulers.Schedulers;

/**
 * Created by Jolly on 2018/9/2.
 */

public class StockInDetailPresenter extends StockInDetailContract.Presenter {
    @Override
    public void getStockInDetail(String sign, String timeStamp, String stockId) {
        mRxManage.add(mModel.getStockInDetail(sign, timeStamp, stockId).unsubscribeOn(Schedulers.io()).subscribe(new HttpResultSubscriber<StockInDetailBean>() {
            @Override
            public void onError(HttpExceptionHandle.ResponeThrowable e) {
                mView.hideLoading();
                mView.showMessage(e.ErrorInfo);
            }

            @Override
            public void onNext(StockInDetailBean stockInDetailBean) {
                mView.hideLoading();
                mView.getStockInDetail(stockInDetailBean);
            }
        }));
    }

    @Override
    public void onStart() {
        mView.getDate();
    }

}
